home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
IRIX Base Documentation 1998 November
/
IRIX 6.5.2 Base Documentation November 1998.img
/
usr
/
share
/
catman
/
p_man
/
cat3
/
Xm
/
XmeGetDesktopColorCells.z
/
XmeGetDesktopColorCells
Wrap
Text File
|
1998-10-30
|
13KB
|
265 lines
XXXXmmmmeeeeGGGGeeeettttDDDDeeeesssskkkkttttooooppppCCCCoooolllloooorrrrCCCCeeeellllllllssss((((3333XXXX))))UUUUNNNNIIIIXXXX SSSSyyyysssstttteeeemmmm VVVVXXXXmmmmeeeeGGGGeeeettttDDDDeeeesssskkkkttttooooppppCCCCoooolllloooorrrrCCCCeeeellllllllssss((((3333XXXX))))
NNNNAAAAMMMMEEEE
XXXXmmmmeeeeGGGGeeeettttDDDDeeeesssskkkkttttooooppppCCCCoooolllloooorrrrCCCCeeeellllllllssss - return desktop pixel data in
XXXXCCCCoooolllloooorrrr[[[[]]]] format
SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
#include <Xm/ColorObjP.h>
BBBBoooooooolllleeeeaaaannnn XXXXmmmmeeeeGGGGeeeettttDDDDeeeesssskkkkttttooooppppCCCCoooolllloooorrrrCCCCeeeellllllllssss(
SSSSccccrrrreeeeeeeennnn ****ssssccccrrrreeeeeeeennnn,
CCCCoooolllloooorrrrmmmmaaaapppp ccccoooolllloooorrrrmmmmaaaapppp,
XXXXCCCCoooolllloooorrrr ****ccccoooolllloooorrrrssss,
iiiinnnntttt nnnn____ccccoooolllloooorrrrssss,
iiiinnnntttt ****nnnn____ccccoooolllloooorrrrssss____rrrreeeetttt);
VVVVEEEERRRRSSSSIIIIOOOONNNN
This page documents Motif 2.1.
DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
The Motif library creates and maintains a CCCCoooolllloooorrrrOOOObbbbjjjjeeeecccctttt at
application initialization time (first _V_e_n_d_o_r_S_h_e_l_l creation)
which holds color information coming from a Color Server
running on the desktop (see Color Server protocol). An
application that needs to use a private colormap should
include in its colormap the desktop pixels returned by the
Color Server protocol, plus the pixels used for the desktop
icons, so that the rest of the desktop doesn't go
"technicolor" when the application colormap is installed
(and the desktop default colormap is de-installed). This
function calls XXXXmmmmeeeeGGGGeeeettttCCCCoooolllloooorrrrOOOObbbbjjjjDDDDaaaattttaaaa((((ssssccccrrrreeeeeeeennnn............)))), in order to
get the raw pixel information and fill out the XXXXCCCCoooolllloooorrrr[[[[]]]]
color array for as many pixels as specified by the ccccoooolllloooorrrrUUUUsssseeee
attributes, and then determine the RGB components for these
pixel in the desktop colormap.
After it has retrieved the pixels of this screen's color
object using _X_m_e_G_e_t_C_o_l_o_r_O_b_j_D_a_t_a, and added the pixels to the
Color calculation cache in Motif (so that widgets created
with a colormap set to share pixels get the right pixels for
derived colors like shadows) this function calls
_X_Q_u_e_r_y_C_o_l_o_r_son the default colormap to get the RGB intensity
values for the desktop pixels in the XColor elements. It
also sets all the flags to ((((DDDDooooRRRReeeedddd||||DDDDooooGGGGrrrreeeeeeeennnn||||DDDDooooBBBBlllluuuueeee))))in the
XColor array.
For the icon pixels, the function use _X_P_a_r_s_e_C_o_l_o_rand
_X_A_l_l_o_c_C_o_l_o_r on the default colormap using the 16 standard
desktop icon color names ( """"bbbbllllaaaacccckkkk"""",,,, """"wwwwhhhhiiiitttteeee"""",,,, """"rrrreeeedddd"""",,,, """"ggggrrrreeeeeeeennnn"""",,,,
""""bbbblllluuuueeee"""",,,, """"yyyyeeeelllllllloooowwww"""",,,, """"ccccyyyyaaaannnn"""",,,, """"mmmmaaaaggggeeeennnnttttaaaa"""",,,, """"####ddddeeeeddddeeeeddddeeeeddddeeeeddddeeeeddddeeee"""",,,,
""""####bbbbddddbbbbddddbbbbddddbbbbddddbbbbddddbbbbdddd"""",,,, """"####aaaaddddaaaaddddaaaaddddaaaaddddaaaaddddaaaadddd"""",,,, """"####999944449999444499994444999944449999444499994444"""",,,,
""""####777733337777333377773333777733337777333377773333"""",,,, """"####666633336666333366663333666633336666333366663333"""",,,, """"####444422224444222244442222444422224444222244442222"""",,,,
""""####222211112222111122221111222211112222111122221111"""") to find out the pixel ids that need to be
shared.
Page 1 (printed 10/24/98)
XXXXmmmmeeeeGGGGeeeettttDDDDeeeesssskkkkttttooooppppCCCCoooolllloooorrrrCCCCeeeellllllllssss((((3333XXXX))))UUUUNNNNIIIIXXXX SSSSyyyysssstttteeeemmmm VVVVXXXXmmmmeeeeGGGGeeeettttDDDDeeeesssskkkkttttooooppppCCCCoooolllloooorrrrCCCCeeeellllllllssss((((3333XXXX))))
_X_m_e_G_e_t_D_e_s_k_t_o_p_C_o_l_o_r_C_e_l_l_s returns most-interesting-pixels
first, and guarantees no duplicate pixel entries (which is
not the same as duplicate RGB entries)
The order in the _X_C_o_l_o_r array on return is:
+o Foreground and background for all 8 palettes (primary,
secondary, text, active, inactive, front-panel, ws
buttons, in that order)
+o Select color for primary, secondary
+o The icon pixels (2 for _L_O_W__C_O_L_O_R and BBBB____WWWW, 16 for _H_I_G_H
and _M_E_D_I_U_M__C_O_L_O_R)
+o TTTTooooppppsssshhhhaaaaddddoooowwww color for all 8 palettes
+o BBBBoooottttttttoooommmmsssshhhhaaaaddddoooowwww color for all 8 palettes (same order as
above)
+o Rest of select colors
The idea is that if an application has only, say, 12 pixels
to spare in its colormap for the desktop, it should get
shared pixels that allow most of the desktop visual to be
usable: foreground and background colors first, mainly.
_s_c_r_e_e_n X screen passed in.
_c_o_l_o_r_m_a_p Colormap for which the pixel are fetched
_c_o_l_o_r_s X color structures returned (allocated by called).
_n__c_o_l_o_r_s Size available in colors array.
_n__c_o_l_o_r_s__r_e_t
Number of X colors elements filled by the function
RRRREEEETTTTUUUURRRRNNNN VVVVAAAALLLLUUUUEEEE
False if _X_m_e_G_e_t_C_o_l_o_r_O_b_j_D_a_t_a returns False, or if ccccoooolllloooorrrrUUUUsssseeee is
_X_m_C_O__B_L_A_C_K__W_H_I_T_E.
SSSSTTTTRRRRUUUUCCCCTTTTUUUURRRREEEESSSS
_X_C_o_l_o_r is defined in Xlib.
EEEENNNNVVVVIIIIRRRROOOONNNNMMMMEEEENNNNTTTT
The information returned by this function depends on the
presence of an active Color Server.
RRRREEEESSSSOOOOUUUURRRRCCCCEEEESSSS
This function is affected by the resources set on the Color
Server and useColorObj on XmScreen.
Page 2 (printed 10/24/98)
XXXXmmmmeeeeGGGGeeeettttDDDDeeeesssskkkkttttooooppppCCCCoooolllloooorrrrCCCCeeeellllllllssss((((3333XXXX))))UUUUNNNNIIIIXXXX SSSSyyyysssstttteeeemmmm VVVVXXXXmmmmeeeeGGGGeeeettttDDDDeeeesssskkkkttttooooppppCCCCoooolllloooorrrrCCCCeeeellllllllssss((((3333XXXX))))
AAAACCCCTTTTIIIIOOOONNNNSSSS////MMMMEEEESSSSSSSSAAAAGGGGEEEESSSS
None.
EEEERRRRRRRROOOORRRRSSSS////WWWWAAAARRRRNNNNIIIINNNNGGGGSSSS
None.
EEEEXXXXAAAAMMMMPPPPLLLLEEEESSSS
After calling this function, the application can then add
more entries to the XXXXCCCCoooolllloooorrrr[[[[]]]] array (it can do that before in
fact) and call _X_S_t_o_r_e_C_o_l_o_r_s with this XXXXCCCCoooolllloooorrrr[[[[]]]] on the new
colormap (note that if a program wants to use a private
colormap and share the desktop pixels, a RRRReeeeaaaaddddWWWWrrrriiiitttteeee colormap
must be used, since pixel have to be allocated at specific
location, which is not possible with read-only cells.)
static void
SetColormap(Widget widget,
int pixel_for_desktop)
{
Colormap my_colormap;
int ncolors_ret, i, p;
XColor colors[256];
if (!XtIsRealized(widget)) return;
/* create a readwrite colormap */
my_colormap = XCreateColormap(XtDisplay(widget),
XtWindow(widget),
XDefaultVisual(XtDisplay(widget), 0),
AllocAll);
/* we need to keep track of which pixel are used, mark
them all free before calling XmeGet... */
for(i=0; i<256; i++) colors[i].pixel = -1;
/* get the desktop pixels in the array */
XmeGetDesktopColorCells (XtScreen(widget), my_colormap,
colors, pixel_for_desktop,
&ncolors_ret);
/* then fill in the rest of our private colormap */
for(i=ncolors_ret, p = 0; i<256; i++) {
/* get a free pixel id */
while (p <= 255 && colors[p].pixel != -1) p ++;
colors[i].pixel = p;
color[i].flags = DoRed|DoGreen|DoBlue;
color[i].red = color[i].green = color[i].blue = i * 256;
}
XStoreColors(XtDisplay(widget), my_colormap, colors, 256);
XtVaSetValues(widget, XmNcolormap, my_colormap, NULL);
}
Page 3 (printed 10/24/98)
XXXXmmmmeeeeGGGGeeeettttDDDDeeeesssskkkkttttooooppppCCCCoooolllloooorrrrCCCCeeeellllllllssss((((3333XXXX))))UUUUNNNNIIIIXXXX SSSSyyyysssstttteeeemmmm VVVVXXXXmmmmeeeeGGGGeeeettttDDDDeeeesssskkkkttttooooppppCCCCoooolllloooorrrrCCCCeeeellllllllssss((((3333XXXX))))
main () {
toplevel = XtAppInitialize(...);
XtRealizeWidget(toplevel);
SetColormap (toplevel, 40);
...
}
SSSSEEEEEEEE AAAALLLLSSSSOOOO
, , XXXXmmmmeeeeGGGGeeeettttCCCCoooolllloooorrrrOOOObbbbjjjjDDDDaaaattttaaaa(3)
Page 4 (printed 10/24/98)